/*
 * JSExtension.java - ScriptME
 * 
 * Copyright (c) 2009 Cesar Henriques <cesar at alttab.com.ar>.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Based on FESI Project
 * 
 * Contributors:
 * 	Jean-Marc Lugrin - initial API and implementation
 * 	Cesar Henriques <cesar at alttab.com.ar> - J2ME Porting and Extensions
 */
package org.scriptme.ecmascript.jslib;

/**
 * Interface used to describe EcmaScript extensions with the jslib package. An
 * extension must implements this interface to be loadable. A new instance of
 * the extension is created by FESI at load time.
 * <P>
 * As there can be multiple extension (possibly in multiple threads) in a single
 * project, an extension should not have shared static properties (unless
 * protected and to share information between various instances).
 */
abstract public interface JSExtension {

	/**
	 * Called by the FESI interpreter the first time the extension is loaded in
	 * the evaluator.
	 * 
	 * @param globalObject
	 *            the global object
	 * 
	 * @throws JSException
	 *             the JS exception
	 * 
	 * @exception JSException
	 *                To be thrown in case of error
	 */
	abstract public void initializeExtension(JSGlobalObject globalObject)
			throws JSException;
}
